<%-- 
  - Author:Asna Khader
  - Date: 08-Feb-2012
  - Copyright Notice: TRAKHEES
  - Description: Show all requests jsp
 --%>
 <%@ include file="/WEB-INF/view/include.jsp"%>

    <div class="t_tmiddle-right">
	      <form:form modelAttribute="EmploymentVisaReviewerInfo" name="EmploymentVisaReviewFrm"  id="EmploymentVisaReviewFrm"  method="POST" class="t_form">
				<spring:hasBindErrors
							name="EmploymentVisaReviewerInfo">
								<script type="text/javascript">
									$(document).ready(
											function() {
												jAlert('error', '<li><form:errors path="*" delimiter="<li>"/>',
														'<spring:message code="label.errormessage" />');
											});
						</script>
			    </spring:hasBindErrors>
		  
				<%@include file="EmployeeDetailsTab.jsp" %>
				<%@include file="PassportDetailsTab.jsp" %>
				<%@include file="PersonalDetailsTab.jsp" %>
	       		<%@include file="AddressDetailsTab.jsp" %>
				<%@include file="CommentsTab.jsp" %>
	        	<%@include file="AttachmentsTab.jsp" %>
	        	<div id="backgroundPopup"></div>
		 </form:form>
	      
       </div>
    <!--Middle Right Close-->
<script>
    		var popupStatus = 0;

//loading popup with jQuery magic!
function loadPopup( divid){
	//loads popup only if it is disabled
	if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("slow");
		$("#"+divid+".t_pop_up").fadeIn("slow");
		popupStatus = 1;
	}
}

//disabling popup with jQuery magic!
function disablePopup(){
	//disables popup only if it is enabled
	if(popupStatus==1){
		$("#backgroundPopup").fadeOut("slow");
		$(".t_pop_up").fadeOut("slow");
		popupStatus = 0;
	}
}

//centering popup
function centerPopup(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $(".t_pop_up").height();
	var popupWidth = $(".t_pop_up").width();
	//centering
	$(".t_pop_up").css({
		"position": "absolute",
		"top": windowHeight/4-popupHeight/4,
		"left": windowWidth/4-popupWidth/4
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight
	});
	
}


function openPopup(divid){
		//centering with css
		centerPopup();
		//load popup
		loadPopup(divid);
}    
		$().ready(function() {
			//CLOSING POPUP
			//Click the x event!
			$("#popupContactClose").click(function(){
				disablePopup();
			});
			//Click out event!
			$("#backgroundPopup").click(function(){
				disablePopup();
			});
			//Press Escape event!
			$(document).keypress(function(e){
				if(e.keyCode==27 && popupStatus==1){
					disablePopup();
				}
			});
		
			$(".topnav").accordion({
				accordion:false,
				speed: 500,
				closedSign: '<img src=\'resources/images/common/close.jpg\' />',
				openedSign: '<img src=\'resources/images/common/open.jpg\' />'
			});
			
			if($('#strNationality').val() != "" && $('#strNationality').val() != null){
				updateCity();
			}			 

		});	
		
		function updateCity() {
		 
	 	$('#strOriginCity >option').remove();
	    $.getJSON("city.json",{contryCode:$("#strNationality").val()},
	    	 function(data) {
	    	
	    	$.each(data,function(key,city){ 		    		
	    		<c:choose>
	    			<c:when
	    				test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
	    					var label = city.labelAr;
	    			</c:when>
	    			<c:otherwise>
	    					var label =  city.labelEn;
	    			</c:otherwise>
	   			</c:choose> 
		    		var id = city.id;
		    		if(id == '${EmploymentVisaReviewerInfo.strOriginCity}'){
		    			$('<option selected=selected/>').val(id).html(label).appendTo('#strOriginCity');
		    		}else{
		    			$('<option/>').val(id).html(label).appendTo('#strOriginCity');
		    		}
	    			
				   
				});
	    	
	    
	    	   });
	     
		  }
		
</script>